#pragma once
#include "yolov7.h"
#include "ShareQueue.h"
#include "ShareMap.h"
#include "Thread.h"

class DetectThread :public Thread {
public:
	DetectThread(std::string classesFile, std::string modelPath,
		int batchSize = 1, int imgWidth = 640, int imgHeight = 640,
		float confThreshold = (double)0.25, float iouThreshold = (double)0.45, bool useGPU = false, int gpuId = 0, long max_gpu_memory = 2147483648);
	~DetectThread();
	void setSendQueueMap(ShareMap<std::string, ShareQueue<std::vector<Detection>>*> *queueMap);
	void setReceiveQueueMap(ShareMap<std::string, ShareQueue<FrameInfo>*> *queueMap);
	bool initilaize(std::string preLoadFile1 = "test1.jpg", std::string preLoadFile2 = "test2.jpg");
	bool isAvaliable();
protected:
	virtual void process() override;

private:
	ShareMap<std::string,ShareQueue<std::vector<Detection>>*> *sendQueueMap;
	ShareMap<std::string,ShareQueue<FrameInfo>*> *receiveQueueMap;
	std::vector<std::string> channelVector;
	std::vector<int64_t> timestampVector;
	YOLOV7 *detector;
	bool canUse = true;
};
